echo "======================================================================="
echo "=                                                                     ="
echo "=                                                                     ="
echo "=                            Make x264                                ="
echo "=                                                                     ="
echo "=                                                                     ="
echo "======================================================================="

cd ../

basepath=$(cd `dirname $0`; pwd)
echo ${basepath}

cd ${basepath}/

if [ -d ./x264-master-build ];then
    rm -r x264-master-build
fi

cp -r x264-master x264-master-build

chmod -R 777 x264-master-build

start=$(date +%s)

cd ${basepath}/x264-master-build/
./configure --prefix=${basepath}/x264_install \
--enable-static --enable-shared

make clean
make -j${THREAD}
make install

end=$(date +%s)


duration=$(( end - start ))
echo "x264 cost: $duration s"